package org.come.shortcut;

import com.tool.image.ImageMixDeal;
import com.tool.tcp.Sprite;
import com.tool.tcp.SpriteFactory;
import com.updateNew.MyIsif;
import org.come.Frame.NPCJfram;
import org.come.shortcut.XBjczBtn;
import com.tool.btn.FormsOnOffBtn;
import com.tool.pet.BabyProperty;
import com.tool.role.RoleData;
import com.tool.tcpimg.UIUtils;
import org.come.Jpanel.BjczJpanel;
import org.come.bean.ConfigureBean;
import org.come.entity.Baby;
import org.come.entity.Goodstable;
import org.come.model.Configure;
import org.come.mouslisten.WLLMouslisten;
import org.come.tt.LadderBoxOpenMouslisten;
import org.come.tt.LadderPanelBtn;
import org.come.until.CutButtonImage;
import org.come.until.UserMessUntil;

import javax.swing.*;
import java.awt.*;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Map;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.List;
import java.util.Map;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;




public class XBjczJpanelgnl extends JPanel {

    private JLabel labtext, labtext1, labtext2;//

    private static FormsOnOffBtn palBtn, protectBtn, qlyBtn,
            dytBtn, dgBtn, CHA, chuan,
            xfBtn, huanj, slBtn, jdBtn, jdBtn1, arenaBtn, pdBtn, yzBtn, huanjzhs,
            TJBtn1, zhuanshen, dnBtn, rwzhuanshen,
            CBGBtn, ttBtn, lsBtn, lsBtn1, fuzhu,
            zaBtn, RanklistBtn, byBtn,
            ypBtn, gangBtn, friendsBtn,
            taskBtn, petBtn, childBtn,
            knapsackBtn, QianDaoMenu, GMshop, TtBtn, bjczBtn, spBtn, ksBtn, bpBtn,baoshi;


    private Goodstable good;
    private static String[] Fvalue;
    private static JTextArea testMes;// 用来显示聊天信息
    public String npczb;
    public static String npcfeiji;


    public XBjczJpanelgnl() {
        this.setPreferredSize(new Dimension(658, 414));
        this.setLayout(null);
        this.setBackground(UIUtils.Color_BACK);

        ConfigureBean allConfigure = UserMessUntil.getConfigureBean();
        Map<BigDecimal, Configure> item = allConfigure.getAllConfigure();
        Configure configure = item.get(new BigDecimal(1));


        /**----------------------------------------功能类-------------------------------------------*/
        //伙伴
        palBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "伙 伴", 105);
        palBtn.setBounds(12, 35, 100, 30);
        this.add(palBtn);
        //道具兑换
        huanj = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "道具兑换", 700);
        huanj.setBounds(12, 35 + 45, 100, 30);//x+95,y+45
        huanj.addMouseListener(new WLLMouslisten(37));
        this.add(huanj);
        //道具兑换
        huanjzhs = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "召唤兽合成", 36);
        huanjzhs.setBounds(12, 35 + 45 * 2, 100, 30);//x+95,y+45
        huanjzhs.addMouseListener(new WLLMouslisten(37));
        this.add(huanjzhs);
        //典当
        TJBtn1 = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "典 当", 29);
        TJBtn1.setBounds(12, 35 + 45 * 3, 100, 30);
        this.add(TJBtn1);
        //赎当取回
        arenaBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "赎当取回", 1024);
        arenaBtn.setBounds(12, 35 + 45 * 4, 100, 30);
        this.add(arenaBtn);
        //医治
        jdBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "医 治", 1026);
        jdBtn.setBounds(12, 35 + 45 * 5, 100, 30);
        this.add(jdBtn);

        //住店
        jdBtn1 = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "住 店", 83);
        jdBtn1.setBounds(12, 35 + 45 * 6, 100, 30);
        this.add(jdBtn1);


//第二例
        //双倍
        lsBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "领 双", 81);
        lsBtn.setBounds(12 + 119, 35, 100, 30);
        this.add(lsBtn);


        //双倍
        lsBtn1 = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "冻 结", 82);
        lsBtn1.setBounds(12 + 119, 35 + 45, 100, 30);
        this.add(lsBtn1);

//            //天梯
//            LadderPanelBtn ladderPanelBtn = new LadderPanelBtn("inkImg/old/1/B463.png", 1, 6);
//            ladderPanelBtn.setBounds(12+119, 35+45, 100, 30);
//            ladderPanelBtn.addMouseListener(new LadderBoxOpenMouslisten());
//            this.add(ladderPanelBtn);

        //千里眼
        qlyBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "千里眼", 1116);
        qlyBtn.setBounds(12 + 119, 35 + 45 * 2, 100, 30);
        this.add(qlyBtn);

        //NPC查询
        chuan = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "NPC查询", 1101);//CHA
        chuan.addMouseListener(new WLLMouslisten(36));
        chuan.setBounds(12 + 119, 35 + 45 * 3, 175, 30);
        this.add(chuan);

        //掉落查询
        CHA = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "掉落查询", 600);
        CHA.setBounds(12 + 119, 35 + 45 * 4, 100, 30);
        this.add(CHA);

        baoshi = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "宝石合成", 85);
        baoshi.setBounds(12 + 119, 35 + 45 * 5, 100, 30);
        this.add(baoshi);

//        NPCJfram.getNpcJfram().getNpcjpanel().baoshi();


        //激情泡点
        pdBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "激情泡点", 3003);//CHA
        pdBtn.setBounds(12 + 119, 35 + 45 * 5, 100, 30);
        if ("开".equals(configure.getPdgnkg())) {
            this.add(pdBtn);
        }
        //SVIP专属
        //GMshop = new FormsOnOffBtn("skin/8100226/button/bjczsvipsm.png", 1, 2000);//CHA
        //GMshop.setBounds(235, 220, 100, 30);
        //this.add(GMshop);


//第三例
//        //转生
//        rwzhuanshen = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "人物转生" ,887);
//        rwzhuanshen.addMouseListener(new WLLMouslisten(4));
//        rwzhuanshen.setBounds(12+119*2, 35, 100, 30);
//        this.add(rwzhuanshen);
        //转生
        zhuanshen = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "召唤兽转生", 999);
//        zhuanshen.addMouseListener(new WLLMouslisten(4));
        zhuanshen.setBounds(12 + 119 * 2, 35, 100, 30);
        this.add(zhuanshen);


        /**-----------------------------------------商店类---------------------------------------*/
//第四例
        //杂货店
        zaBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "杂货店", 79);
//            zaBtn.addMouseListener(new WLLMouslisten(5));
        zaBtn.setBounds(385, 35, 100, 30);
        this.add(zaBtn);
        //藏宝阁
        CBGBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "藏宝阁", 78);
        CBGBtn.setBounds(385, 35 + 45, 100, 30);
        this.add(CBGBtn);
        //大雁塔
        dytBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "大雁塔", 120);
        dytBtn.setBounds(385, 35 + 45 * 2, 100, 30);//x+95,y+45
        this.add(dytBtn);
        //地宫商店
        dgBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "地宫商店", 121);
        dgBtn.setBounds(385, 35 + 45 * 3, 100, 30);//x+95,y+45
        this.add(dgBtn);
        //寻芳商店
        xfBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "寻芳商店", 123);
        xfBtn.setBounds(385, 35 + 45 * 4, 100, 30);//x+95,y+45
        this.add(xfBtn);
        //水陆商店
        slBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "水陆商店", 126);
        slBtn.setBounds(385, 35 + 45 * 5, 100, 30);//x+95,y+45
        this.add(slBtn);

        //勇者兑换
        yzBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "勇者兑换", 92);
        yzBtn.setBounds(385, 35 + 45 * 6, 100, 30);//x+95,y+45
        this.add(yzBtn);


//第五例
        //大闹天宫
        dnBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "大闹天宫", 128);
        dnBtn.setBounds(385 + 119, 35, 100, 30);
        this.add(dnBtn);

        //药品商店
        ypBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "药品商店", 131);
        ypBtn.setBounds(385 + 119, 35 + 45, 100, 30);
        this.add(ypBtn);
        //符文商店
        byBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "符文商店", 130);
        byBtn.setBounds(385 + 119, 35 + 45 * 2, 100, 30);
        this.add(byBtn);
        //绑玉商店
        byBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "绑玉商店", 129);
        byBtn.setBounds(385 + 119, 35 + 45 * 3, 100, 30);
        this.add(byBtn);

        if ("开".equals(configure.getTtgnkg())) {
            //天梯商店
            ttBtn = new FormsOnOffBtn("inkImg/old/1/B463.png", 1, UIUtils.COLOR_WHITE2, "天梯商店", 127);
            ttBtn.setBounds(385 + 119, 35 + 45 * 4, 100, 30);//x+95,y+45
            this.add(ttBtn);
        }


    }

    ImageIcon icon;

    @Override
    protected void paintComponent(Graphics g) {
        // TODO Auto-generated method stub
        super.paintComponent(g);
        if (icon == null) {
            icon = new ImageIcon("inkImg/newbackground/B299x.png");
        }
        g.drawImage(icon.getImage(), 0, 0, 619, 353, this);
    }


    public static int getCurrentMonthDay() {
        Calendar a = Calendar.getInstance();

        a.set(Calendar.DATE, 1);

        a.roll(Calendar.DATE, -1);

        int maxDate = a.get(Calendar.DATE);

        return maxDate;

    }


    public Goodstable getGood() {
        return good;
    }

    public void setGood(Goodstable good) {
        this.good = good;
    }

    public String[] getFvalue() {
        return Fvalue;
    }

    public void setFvalue(String[] fvalue) {
        Fvalue = fvalue;
    }

    public JTextArea getTestMes() {
        return testMes;
    }

    public void setTestMes(JTextArea testMes) {
        XBjczJpanelgnl.testMes = testMes;
    }


}

